<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
const arr = [1, 3, 2, 6, 15, 12, 10];
function quickSort (arr) {
    if (arr.length < 2) {
        return arr;
    }
    const flag = arr[0];
    const left = [];
    const right = [];
    for (let i = 1; i < arr.length; i++) {
        const item = arr[i];
        if (item > flag) {
            right.push(item);
        } else {
            left.push(item);
        }
    }
    return [...quickSort(left), flag, ...quickSort(right)];
}
console.log(quickSort (arr));
    </script>
</body>
</html>